package com.musicstore.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.musicstore.biz.GenreBiz;
import com.musicstore.entity.GenreEntity;

@Controller  //springmvc文件扫描注释
public class GenreController {
	@Autowired
	private GenreBiz genreBiz;
	//最简单的方式
	@RequestMapping("/getAll")//从控制器传数据到视图
	public String getAll(Model model)
	{
		List<GenreEntity> genrelist = genreBiz.getAll();
		model.addAttribute("genrelist",genrelist);
		return "index";//返回视图名
	}
	
}
